Going to the (VB Editor’s) Dark Side

So, if you really, really want to go to the dark side with the VBE, try this . . .
Fire up Excel if she’s not already running. And then meander over to the Visual Basic Editor.

You can click the Visual Basic button on the Developer Ribbon Tab.

Although, if you’re a keyboard shortcut freak like me, it’s way faster to press ALT+F11 on your keyboard.

https://i0.wp.com/myexcelgenius.com/wp-content/uploads/B006-Developer-Ribbon-Open-Visual-Basic-Editor.png?resize=696%2C167&ssl=1

If you’ve got a code module open already, your screen might look something like this:

https://i1.wp.com/myexcelgenius.com/wp-content/uploads/B006-Excel-White-VBE-with-VBA-Code.png?resize=696%2C427&ssl=1

Brrr. Cold White. Let’s change that.

So now you’re in the VBE, from the Tools menu choose Options.

This will display the Options screen. Now select the Editor Format tab:

https://i0.wp.com/myexcelgenius.com/wp-content/uploads/B006-VBE-Options-Editor-Format.png?resize=564%2C361&ssl=1

This screen gives you all the options to change the colours.

Let’s take a look at the choices you have in a bit more detail.

https://i2.wp.com/myexcelgenius.com/wp-content/uploads/B006-Parts-of-the-VBE-Options-Editor-Format.png?resize=696%2C454&ssl=1

The Code Color list has each type of VBA code display you can change.
For example, ‘Normal Text’ is standard VBA text while ‘Keyword Text’ is for VBA keywords like ‘Dim’ and ‘Function’.

Foreground represents the colour of the text itself.

Background represents the colour of the page directly behind the text

Indicator is the colour of any symbol in the margin such as the circle which appears in the margin when you set a break point.

Font is exactly what it says on the tin. It allows you to change the font, although the selection is limited.

How to Customize the Visual Basic Editor Colors

Let’s change the colours so it look like the proper VBA code in Excel’s Visual Basic Editor screenshot above.

1

If it’s not currently open, display the Options screens. In the VBA Editor, from the Tools menu, select Options and then select the Editor Format tab.

2

In the list of Code Colors, select ‘Normal Text’.

3

From the Foreground dropdown list, select ‘Yellow’.

4

From the Background dropdown list select ‘Black’.

5

From the Indicator dropdown, select ‘Auto’.

You now want to repeat this process for each of the colour choices below:

https://i1.wp.com/myexcelgenius.com/wp-content/uploads/B006-Dark-Side-Colour-Table.png?resize=610%2C286&ssl=1

Call me old school, but I like the FixedSys font.

It’s thick and easy to read. Have a play with some of the font options.
When you’re done, click OK.

Depending on which windows you have showing, your screen will look something like this example which also shows a Break Point and a code syntax error:

https://i2.wp.com/myexcelgenius.com/wp-content/uploads/B006-Excel-Dark-Full-VBE-with-VBA-Code.png?resize=696%2C427&ssl=1

The first thing you’ll notice is that Excel does not apply your fancy colour scheme to the entire Visual Basic Editor.

In fact, Excel only changes the main code window and the Immediate Window.

Hmm, not what I was hoping for. How about you?

However if you hiding all the other windows and just leave the main code window visible with the menu and toolbars showing, you can end up with something like this:

https://i1.wp.com/myexcelgenius.com/wp-content/uploads/B006-Excel-Dark-VBE-Toolbars-Only-VBA-Code.png?resize=696%2C439&ssl=1

Admittedly I’m not one to claim any form of “colour co-ordination skills” so you’ll probably want to experiment with some colour combinations or copy the colours from your favourite ‘modern’ code editor. Note however, that the selection of colours is fixed and you can’t edit them.

If after all your experimenting with colours you decide you’d prefer the original colour, you can always set them back to the default.

Unfortunately, you’ll have to do that manually as well. It’s a shame there’s no option so save a colour combination as a ‘theme’.

If you do decide you’d prefer to code VBA on the ‘Light Side’, here’s the colour scheme so you can change it back:

https://i1.wp.com/myexcelgenius.com/wp-content/uploads/B006-Standard-VBE-Colour-Table.png?resize=610%2C286&ssl=1

The whole process is a little tedious, I know, and you’ll probably need to experiment a little to get the “look” you’re after.

Third Party Tools to Customize the VBE Editor Colors

If you want more control over the Visual Basic Editor Colour than what Microsoft grant you, you also have some third-party tools available.

FMS Total Visual CodeTools

FMS, who have been making excellent VBA-related development tools for decades have a product called Total Visual CodeTools. This includes a ‘VBE Color Scheme Manager’ so you can “easily see and set colors for your editor”.

https://i1.wp.com/myexcelgenius.com/wp-content/uploads/B006-FMS-Total-Visual-CodeTools-Color-Schemes.png?resize=650%2C490&ssl=1

It may not have the ability to edit the colours, but it allows you to save colour schemes and see the affect of the changes as you make them.

VBE Theme Editor

Meanwhile a SuperUser

 contributor Dimitri Mitropoulos (a.k.a. Gallaux) created a GitHub project called VBE Custom Colors. Dimitri even made the source code available if you want to have a play with it.

https://i1.wp.com/myexcelgenius.com/wp-content/uploads/B006-GIT-Project-VBE-Theme-Editor.png?ssl=1

The really cool thing about the VBE Theme Editor is that it allows you to change the default colors so you can get results like this.

https://i1.wp.com/myexcelgenius.com/wp-content/uploads/B006-GIT-Project-VBE-Theme-Editor-Example.jpg?ssl=1

Be wary though, as the approach does make changes to the Visual Basic Editor Dynamic Linked Library file (VBE.DLL). Always, I mean always, make a backup before you change any system files. 

Conclusion

As you can see, changing the colours of the Visual Basic Editor is possible albeit limited.

Have you found any smarter ways to customize the look and feel of the Visual Basic Editor?

Let me know in the comments below.

Alternatively, would you care to share a screenshot of your Visual Basic Editor customizations?